<?php

class Usuarios_Form_Usuarios extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	$this->setName("registro");
    	$this->setMethod('post');
    	$elementos = array();
    	 
    	$nome = new Zend_Form_Element_Text('nome');
    	$nome->setLabel("Nome")
    	->setRequired(TRUE)
    	->setFilters(array("StripTags", "StringTrim"))
    	->setValidators(array("NotEmpty"))
    	;
    	
    	$elementos[] = $nome;
    	
    	$email = new Zend_Form_Element_Text('email');
    	$email->setLabel("Email")
    	->setFilters(array("StripTags", "StringTrim"))
    	->setValidators(array("EmailAddress"));
    	
    	$elementos[] = $email;
    	
    	$fone = new Zend_Form_Element_Text('telefone');
    	$fone->setLabel("Telefone")
    	->setFilters(array("StripTags", "StringTrim"))
    	->setValidators(array("Digits"));
    	 
    	$elementos[] = $fone;
    	
    	#######
    	$modperfil = new Usuarios_Model_DbTable_Perfil();
    	$selctfill = array(0=>"-----");
    	$selctfill += $modperfil->fillSelectPerfil();
    	$perfil = new Zend_Form_Element_Select("id_perfil");
    	$perfil->setLabel("Perfil")
    	->setRequired(TRUE)
    	->addMultiOptions($selctfill);
    	#
    	#$modperfil->fillSelectPerfil();
    	$elementos[] = $perfil;
    	#######
    	
    	#$permissao = new Zend_Form_Element_Hidden('id_perfil');
    	#$permissao->removeDecorator('HtmlTag')
    	#->setValue(0)
    	#->removeDecorator('Label');
    	
    	#$elementos[] = $permissao;
    	
    	$enviar = new Zend_Form_Element_Submit("submit");
    	$enviar->setIgnore(true)
    	->setLabel("Alterar")
    	->removeDecorator('HtmlTag');
    	$elementos[] = $enviar;
    	
    	$token = new Zend_Form_Element_Hash('token');
    	$token->setSalt('s4a1t-53gur0')
    	->setTimeout(300)
    	->setIgnore(true)
    	->removeDecorator('HtmlTag')
    	->removeDecorator('Label')
    	->addErrorMessage(_('Token provided did not match, session expired. Please reload the form.'));
    	;
    	$elementos[] = $token;
    	$this->addElements($elementos);
    }


}

